package com.jk.service.account;

import com.jk.dao.account.AccDepartmentDao;
import com.jk.entity.account.AccDepartment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * ACC_DEPARTMENT service
 * Tue Sep 22 11:02:19 CST 2015 yanghuan
 */
@Service
public class AccDepartmentService {

    @Autowired
    private AccDepartmentDao accDepartmentDao;

    public int insert(AccDepartment accDepartment) throws DataAccessException {
        return accDepartmentDao.insert(accDepartment);
    }

    public int delete(String accDepartmentId) throws DataAccessException {
        return accDepartmentDao.deleteByPrimaryKey(accDepartmentId);
    }

    public List<AccDepartment> selectAll() throws DataAccessException {
        List<AccDepartment> accDepartmentList = accDepartmentDao.selectAll();
        if (null == accDepartmentList) {
            return new ArrayList<AccDepartment>();
        } else {
            return accDepartmentList;
        }
    }

}

